package com.wugui.datax.admin;

import java.net.InetAddress;
import java.net.UnknownHostException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.core.env.Environment;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
//@EnableAutoConfiguration(exclude = { FreeMarkerAutoConfiguration.class })
@SpringBootApplication(exclude = { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class })
public class DataXAdminApplication {

	private static Logger logger = LoggerFactory.getLogger(DataXAdminApplication.class);

	public static void main(String[] args) throws UnknownHostException {
		Environment env = new SpringApplication(DataXAdminApplication.class).run(args).getEnvironment();
		String envPort = env.getProperty("server.port");
		String envContext = env.getProperty("server.contextPath");
		String port = envPort == null ? "8080" : envPort;
		String context = envContext == null ? "" : envContext;
		String ip = InetAddress.getLocalHost().getHostAddress();
		logger.info("------------------Access URLs:----------------------------");
		logger.info("Local-API: \thttp://{}:{}{}/doc.html", ip, context, port);
		logger.info("web-URL: \thttp://{}:{}{}/index.html", ip, context, port);
		logger.info("----------------------------------------------------------");
	}

}
